/**
 * 
 */
package com.hexacta.hrs.services.jobcandidate.impl;

import java.util.Collection;

import org.vectrics.recruiter.job.JobCandidate;
import org.vectrics.recruiter.user.CandidateInfo;

import com.hexacta.hrs.repositories.impl.JobCandidateRecordObjectRepository;
import com.hexacta.hrs.services.jobcandidate.JobCandidateService;

/**
 * @author mfunes
 *
 */
public class JobCandidateServiceImpl implements JobCandidateService {

    private JobCandidateRecordObjectRepository jobCandidateGenericRepository;
    
    public JobCandidateRecordObjectRepository getJobCandidateGenericRepository() {
        return jobCandidateGenericRepository;
    }

    public void setJobCandidateGenericRepository(JobCandidateRecordObjectRepository jobCandidateGenericRepository) {
        this.jobCandidateGenericRepository = jobCandidateGenericRepository;
    }

    /* (non-Javadoc)
     * @see com.hexacta.hrs.services.jobcandidate.JobCandidateService#findByCandidateInfo(org.vectrics.recruiter.user.CandidateInfo)
     */
    @Override
    public Collection<JobCandidate> findByCandidateInfo(CandidateInfo candidateInfo) {
        JobCandidate jobCandidate = this.createNew();
        jobCandidate.setCandidate(candidateInfo);
        jobCandidate.setDateAdded(null);
        jobCandidate.setEmployerRejectReasons(null);
        jobCandidate.setJobCandidateOfferList(null);
        jobCandidate.setLog(null);
        jobCandidate.setSkillScore(null);
        jobCandidate.setStatusList(null);
        jobCandidate.setStrength(null);
        jobCandidate.setCandidateRejectReasons(null);
        return this.searchByCriteria(jobCandidate);
    }

    /* (non-Javadoc)
     * @see com.hexacta.hrs.services.crud.CrudService#createNew()
     */
    @Override
    public JobCandidate createNew() {
        return new JobCandidate();
    }

    /* (non-Javadoc)
     * @see com.hexacta.hrs.services.crud.CrudService#delete(org.vectrics.common.db.RecordObject)
     */
    @Override
    public void delete(JobCandidate recordObject) {
        // TODO Auto-generated method stub
    }

    /* (non-Javadoc)
     * @see com.hexacta.hrs.services.crud.CrudService#save(org.vectrics.common.db.RecordObject)
     */
    @Override
    public void save(JobCandidate recordObject) {
        // TODO Auto-generated method stub
    }

    /* (non-Javadoc)
     * @see com.hexacta.hrs.services.crud.CrudService#searchByCriteria(org.vectrics.common.db.RecordObject)
     */
    @Override
    public Collection<JobCandidate> searchByCriteria(JobCandidate criteria) {
        return jobCandidateGenericRepository.matching(criteria);
    }

    /* (non-Javadoc)
     * @see com.hexacta.hrs.services.crud.CrudService#searchById(long)
     */
    @Override
    public JobCandidate searchById(long id) {
        return jobCandidateGenericRepository.forId(id);
    }
}
